<?php

class Admin_Form_Newuser extends Zend_Form {

    public function init() {
        parent::init();
        $this->initFields();
    }

    public function initFields() {
        $elements = array();
        
        $elements[] = $this->createRequiredField("username");
        $elements[] = $this->createRequiredField("password");
        $elements[] = $this->createRequiredField("confirm_password");
        $elements[] = $this->createRequiredField("fullname");
        $elements[] = $this->createRequiredField("email");
        $elements[] = $this->createRequiredField("phone");
        $elements[] = $this->createRequiredField("address");
        
        $country = new Zend_Form_Element_Multiselect("country");
        $country->setMultiOptions(Core_Util::getCountryList())->setRequired();
        $elements[] = $country;
        
        $role = new Zend_Form_Element_Multiselect("role");
        $role->setMultiOptions(Core_Util::getRoleList());
        $elements[] = $role;
        
        $this->addElements($elements);
    }
    
    protected function createRequiredField($name) {
        $element = new Zend_Form_Element_Text($name);
        $element->setRequired();
        return $element;
    }

}

?>
